<?php
// +----------------------------------------------------------------------
// | YFCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2016 http://www.rainfer.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: rainfer <81818832@qq.com>
// +----------------------------------------------------------------------

namespace app\admin\model;

use think\Model;

/**
 * 文章模型
 * @package app\admin\model
 */
class MessageContent extends Model
{
	protected $table = 'message_content';

	public function addMessageContent($send_uid, $send_type, $title, $contents)
    { 
        $send_uid = intval($send_uid);
        $send_type = intval($send_type);
        $title = trim(strip_tags($title));
        $contents = $contents;
        
        if ($send_uid == 0 || $send_type == 0) {
            return 0;
        }
        
        $messageContent = array();
        $messageContent['title'] = $title;
        $messageContent['contents'] = $contents;
        $messageContent['send_status'] = 1;
        $messageContent['send_time'] = time();
        $messageContent['send_type'] = $send_type;
        $messageContent['send_uid'] = $send_uid;
        $messageContent['createtime'] = time();
        $messageContent['deletetag'] = 0;
        
        $insert = self::create($messageContent);
		if($insert){
			return $insert['id'];
		}else{
			return 0;
		}
    }
    
}
